﻿define(['SWFObject'], function (swfobject) {
    var uploadId = 'upload';
    var upload = {
        init: function (params) {
            var flashvars = {};
            flashvars['id'] = uploadId;
            for (var attr in params) {
                switch (attr) {
                    case "container": break;
                    case "width": break;
                    case "height": break;
                    default:
                        flashvars[attr] = params[attr];
                        break;
                }
            }
            addSwf('/Content/Scripts/Components/SwfUpload/upload.swf', params.container, params.width, params.height, flashvars);
        },
        startUpload: function () {
            swfobject.getObjectById(uploadId).startUpload();
        },
        pauseUpload: function () {
            swfobject.getObjectById(uploadId).pauseUpload();
        },
        continueUpload: function () {
            swfobject.getObjectById(uploadId).contiuneUpload();
        }
    };
    return upload;
})